package com.ocm.commerceinteraction.util;

import android.app.Activity;
import android.app.ActivityManager;
import android.content.ComponentName;
import android.content.Context;
import android.util.Log;
import android.widget.Toast;

import com.ocm.commerceinteraction.GlobalApplication;


/**
 * Created by puman on 15/7/21.
 */
public class MethedUtil {
    public static final String Tag = "curry";
    public static final int FROM_FRIEND = 1;
    public static final int FROM_GROUP = 2;

    /**
     * 打印log
     *
     * @param logStr log字符串
     */
    public static void showLog(String logStr) {
        if (logStr == null || logStr.length() == 0)
            return;
        Log.i(Tag, logStr);
    }

    /**
     * @param context
     * @param toastStr
     */
    private static Toast mToast;

    public static void showToast(Context context, String toastStr) {
        if (mToast == null) {
            mToast = Toast.makeText(context, toastStr, Toast.LENGTH_SHORT);
        } else {
            mToast.setText(toastStr);
            mToast.setDuration(Toast.LENGTH_SHORT);
        }
        mToast.show();
    }


    /**
     * 判断字符串中是否全是字符串
     *
     * @param str
     * @return
     */
    public static boolean isNumeric(String str) {
        for (int i = str.length(); --i >= 0; ) {
            if (!Character.isDigit(str.charAt(i))) {
                return false;
            }
        }
        return true;
    }
}
